#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\CST.h>

const char*CSTName = "CST.dat";

static CST_REC srCSTRec;

static int recordNum;
int	inLoadCSTRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(CST_FILENAME, SIZE_CST_REC, inRecNumber, (char *) &srCSTRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetCSTRec(void)
{
	return &srCSTRec;

}

int	inSaveCSTRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(CST_FILENAME, SIZE_CST_REC, inRecNumber, (char *) &srCSTRec);

	return inRet;
}

int	inGetCSTRecNumber (void)
{
	return recordNum;
}

int	inUpdateCSTRec (void)
{
	int inRet;

	inRet = inSaveConfRec(CST_FILENAME, SIZE_CST_REC, recordNum, (char *) &srCSTRec);

	return inRet;
}

void	vdResetCSTRec (void)
{
	memset((void*)&srCSTRec, 0, REC_SIZEOF(srCSTRec));
}

short shGetCurrencyIndex(void)
{
	return srCSTRec.shCurrencyIndex;
}

void vdSetCurrencyIndex(short shCurrencyIndex)
{
	srCSTRec.shCurrencyIndex = shCurrencyIndex;
}

char* szGetCurSymbol(void)
{
	return srCSTRec.szCurSymbol;
}

void vdSetCurSymbol(const char* szCurSymbol)
{
	strNumCopy(srCSTRec.szCurSymbol, szCurSymbol, sizeof(((CST_REC*)NULL)->szCurSymbol)-1);
}

char* szGetCurCode(void)
{
	return srCSTRec.szCurCode;
}

void vdSetCurCode(const char* szCurCode)
{
	strNumCopy(srCSTRec.szCurCode, szCurCode, sizeof(((CST_REC*)NULL)->szCurCode)-1);
}

